package com.wimcorp.magic.behaviour.attack;

import javax.persistence.Entity;

import com.wimcorp.magic.behaviour.attack.AttackBehaviour.AttackType;
import com.wimcorp.magic.cards.Creature;
import com.wimcorp.magic.players.Player;

@Entity
public class AssasinatePlayer extends AttackBehaviour {

	private static AssasinatePlayer instance = new AssasinatePlayer();

	protected AssasinatePlayer() {

	}

	public AssasinatePlayer(Creature creature, AttackBehaviour attackBehaviour) {
		super(creature, attackBehaviour);
	}

	public static AssasinatePlayer instance() {
		return instance;
	}

	protected void attack(Creature defender) {
		getAttackBehaviour().attack(defender);
	}
	
	
	public void counter(Creature attacker) {
		getAttackBehaviour().counter(attacker);
	}

	protected void attack(Player defender) {
		if (getCreature().getActualPower() > 0) {
			defender.subtractLife(defender.getLife());
		}else{
			getAttackBehaviour().attack(defender);
		}
	}

	public int priority() {
		return AttackType.ASSASINATE_PLAYER.ordinal();
	}

	public boolean equals(Object o) {
		return o instanceof AssasinatePlayer;
	}

	

}
